/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package systole.view.tabs.segments;

import org.jfree.chart.ChartPanel;

/**
 *
 * @author jmj
 */
public class JPnlItemAutoSelection extends JPnlItem {

    private JPnlAutoSelection parent;

    public JPnlItemAutoSelection(int segmentNumber, ChartPanel pnl, JPnlAutoSelection parent, String hint) {
        super(segmentNumber, pnl,hint);
        this.parent = parent;
        this.setVisibleCorrelation(false);
    }

    @Override
    public void removeSegment() {
        this.parent.removeSegment(this);
    }

    @Override
    public void click() {
        if (!this.isClicked()) {
            this.setBorder(this.selectedBorder);
            this.revalidate();
            this.setClicked(true);
            this.setFocusable(true);
            this.requestFocusInWindow();
            this.parent.setAsSelected(this);
        }
    }

    @Override
    public void select(){
        this.getJPnlTop().setBackground(this.selectedColor);
        this.getJPnlBottom().setBackground(this.selectedColor);
        this.getJPnlLeft().setBackground(this.selectedColor);
        this.getJPnlRigth().setBackground(this.selectedColor);
    }
}
